<div class="layui-card-header layui-card">
    <span class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">首页</a>
        <a><cite>新建银行账号</cite></a>
    </span>
</div>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">新建银行账号</li>
            </ul>

            <div class="layui-tab-content">
                
                <form class="layui-form center">
                    <div class="layui-form-item">
                        <label class="layui-form-label">账号类型</label>
                        <div class="layui-input-block">
                            <input type="radio" name="accountType" value="1" title="银行账号" checked="checked">
                            <input type="radio" name="accountType" value="2" title="支付宝账号">
                            <input type="radio" name="accountType" value="3" title="微信账号" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">银行名称</label>
                        <div class="layui-input-block">
                            <input type="text" required  name="bankName"  lay-verify="required" placeholder="请输入银行名称" autocomplete="off" class="layui-input accInfo">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">账号名称</label>
                        <div class="layui-input-block">
                            <input type="text" required  name="accountName"  lay-verify="required" placeholder="请输入账号名称" autocomplete="off" class="layui-input accInfo">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">账号</label>
                        <div class="layui-input-block">
                            <input type="text" required  name="accountNo"  lay-verify="required|number" placeholder="请输入账号" autocomplete="off" class="layui-input accInfo">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">备注信息</label>
                        <div class="layui-input-block">
                            <input type="text" required name="remark" placeholder="请输入备注信息" autocomplete="off" class="layui-input remarkInfo">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">默认</label>
                        <div class="layui-input-inline" >
                            <input type="radio" name="isDefault" title="是" value="1" />
                            <input type="radio" name="isDefault" title="否" value="0" checked="checked"/>
                        </div>
                    </div>
                    <div class="layui-form-item ">
                        <div class="layui-input-block">
                            <button type="button" lay-submit lay-filter="btnJS" class="layui-btn">保存</button>
                            <a lay-href="account/bank/" class="layui-btn">返回</a>
                        </div>
                    </div>
                </form>    
            </div>
        </div>
    </div>
</div>
<script>
   
        layui.use(['form','util','admin'], function(){
            var form = layui.form
            ,$ = layui.$
            ,admin = layui.admin
            ,element = layui.element;

            element.render('breadcrumb', 'breadcrumb');//渲染导航信息

            //监听提交
            form.on('submit(btnJS)', function(data){
                // 在这个回调函数里面写ajax提交
                admin.req({
                    type: 'post',
                    url: layui.setter.baseUrl + '/bank_account/add',
                    data: data.field,
                    success: function(res){
                        if(res.code == 0){
                            layer.alert(res.msg,{title: "保存成功"},function(index){
                                layer.close(index);
                                location.hash = '/account/bank/';
                            })
                        }
                    }
                })
                return false;//阻止跳转
            });
            form.render();
        })
</script>